<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/12/30
 * Time: 11:09
 */

?>


<?php

require_once "../DB_Util/sql_helper.php";

//先从前端把id获取
$id = $_POST["id"];

$sql = "SELECT * FROM users WHERE id = {$id} ";

//调用查询函数
$res = query($sql);

$arr = array("code"=>200,"msg"=>"操作失败");
if ($res){
    $arr["code"] = 100;
    $arr["msg"] = "操作成功";
    //在这里返回的数据里面包含有用户名和密码，如果是为了安全，可以只返回头像和昵称
    $arr["data"] = $res[0];
}

echo json_encode($arr,JSON_UNESCAPED_UNICODE);


?>
